![]() | Note: Input resolution specification are reporter in the hardware dossier with the describing the card (or tool). |
|---|
In the configuration unit, the BUS section must be declared must be declared so that they are
present the hardware resources required for the implementation of the ANINP device. Must be present
at least one analog input with a maximum resolution of 16 bits.
In the INTDEVICE section of the configuration unit to add the following definition:
;--------------------------------- ; Devices declaration ;--------------------------------- INTDEVICE ... <nome device> ANINP Tcamp IChn Type
dove:
| <nome device> | Device name |
| NINP | Keyword that identifies the device analog input |
| Tcamp | Time sampling device (1÷255 ms) |
| IChn | input address ADC |
| Type | ID number input type (refer to technical data sheet hardware) |
![]() | Warning: It is necessary that each definition are present on the same line. |
|---|
;--------------------------------- ; Device declaration ;--------------------------------- INTDEVICE AnSensor ANINP 2 2.AI01 1
When the system is powered, the device checks the correct input type declaration use the configuration defined in the unit (Type). If the channel diagnostics ends successfully, data is upgraded on the basis of the time of sampling. NIf errors or inaccuracies are found, the st_errcfgState is set to one and the value of the variableoutbitis forced to zero. The conversion of the data output from the device (outbit), in the measure unit required for the application, is activated by means of scale factors (scaleA, scaleB e scaleC) in accordance with the formula:
outUm = (scaleA x outbit / scaleB) + scaleC
In addition to this updated release based on the sample time of the device, is available the outUmF exit, filtered using a charging time tfilter programmable (expressed in ms).
![]() | This feature allows to filter any disturbances and fluctuations superimposed to the wanted signal with the ability to customize the time of Office of the filter charge (tfilter). |
|---|
A single input can be managed by multiple device ANINP simultaneously, provided that the identification number of the Type entrance, inserted in the device declaration is not less; otherwise the analog input is configured as the last device declared in the configuration file.
The parameter name, condition or command is taken back to the left side of the table.
R
Indicates if its parameter or retentive state (upon initialization of the device
maintains state previously defined), or the State that bears upon
device initialization.
If the device does not require initialization field ' R ' indicates the value that the parameter or State
accept to the card power ON.
R = Retentive
0 = Upon initialization of the device the value is forced to zero.
1 = Upon initialization of the device the value is forced to one.
- = Upon initialization of the device is presented significant value.
D
Indicates the parameter size.
F = Flag
B = Byte
W = Word
L = Long
S = Single Float
Describes all of the conditions that is considered correct or because the command is accepted.
In some cases, limit values are specified for the acceptance of the parameter: If you
any values outside the limits set, the data will still be accepted; must
be provided appropriate controls of the application to ensure proper operation.
To run a command, all the conditions must be
met; otherwise the command is not executed.
A
Access mode.
R = Read.
W = Write.
RW = Read / Write.
| NAME | D | R | A | Conditions | Description |
|---|---|---|---|---|---|
| outbit | W | - | R | No | Output measure in bits Value read by the input channel offset the Offset. Valid range: 0 ÷ 32767 |
| offset | W | R | RW | No | Offset compensation Offset DAC output in bits. Defines the value in bits of the correction on the analog input in order to compensate for any drift in the system. Valid range: -32768 ÷ 32767 |
| scaleA | W | R | RW | No | Scale A Integer A parameter to scaling formula. Valid range: -32768 ÷ 32767 |
| scaleB | W | R | RW | No | Scale B B parameter value used in the formula of scaling. Must be nonzero. Valid range: -32768 ÷ 32767 |
| scaleC | W | R | RW | No | Scale C C parameter value used in the formula of scaling. Valid range: -32768 ÷ 32767 |
| outUm | L | - | R | No | Output measure in unity Exit derived from scaling formula. Valid range: -32768 ÷ 32767 |
| tfilter | W | R | RW | No | Filter time Charging time of RC filter. If filter < = Tcamp device, the filter is disable. Value expressed in ms. Valid range: 0 ÷ 32767 |
| outUmF | L | - | R | No | Filtered output in unity of measure Output filtered in units. Valid range: -32768 ÷ 32767 |
| NOME | D | R | A | Condizioni | Descrizione |
|---|---|---|---|---|---|
| st_errcfg | F | - | R | Nessuna | Configuration error Segnala che è stato rilevato un errore nella configurazione dell'ingresso. 0 = Non è stato rilevato nessun errore. 1 = È stato rilevato un errore. |
ScaleB deve essere impostato diverso da zero, in caso contrario OutUm viene forzato a 0.
Il tempo di carica del filtro RC tfilter deve essere impostato maggiore o uguale al tempo di campionamento del device (Tcamp), in caso contrario viene disattivato il filtro ed il parametro OutUmF viene aggiornata con lo stesso valore di OutUm.
Il parametro offset viene sommato allingresso analogico acquisito (outbit), non viene eseguito il controllo sulloverflow della somma.
Nel caso che un singolo canale venga gestito da più device ANINP aventi Type diversi, il compilatore non rileva errori e il canale viene impostato con lultimo Type dichiarato.
Una singola risorsa hardware (ogni singolo ingresso) può essere gestita da più device ANINP contemporaneamente, a condizione che il numero identificativo dellingresso (Type), inserito nella dichiarazione del device (file di configurazione), sia uguale; in caso contrario lingresso analogico viene configurato come lultimo device dichiarato nel file di configurazione.
;*************************************************************************************
; Nome Modulo: Ex_Aninp.CNF Progetto: Ex_ANINP
; Autore: QEM srl Data : 01/05/99
; Sistema: QMove1 / QCL3 Libreria: 1LIB3B04
; Funzionalità: Esempio gestione ANINP Release: 0
;------------------------------------- Note ------------------------------------------
; [1] - Applicativo di esempio per utilizzo device ANINP
;*************************************************************************************
;-------------------------------------------------------------------------------------
; Definizione Costanti
;-------------------------------------------------------------------------------------
CONST
;-------------------------------------------------------------------------------------
; Definizione Variabili SYSTEM
;-------------------------------------------------------------------------------------
SYSTEM
slSet1 L ;Setpoint 1
slSet2 L ;Setpoint 2
;-------------------------------------------------------------------------------------
; Definizione Variabili GLOBAL
;-------------------------------------------------------------------------------------
GLOBAL
;-------------------------------------------------------------------------------------
; Definizione Variabili TIMER
;-------------------------------------------------------------------------------------
TIMER
;-------------------------------------------------------------------------------------
; Definizione DATAGROUP
;-------------------------------------------------------------------------------------
DATAGROUP
;-------------------------------------------------------------------------------------;
Configurazione Bus
;-------------------------------------------------------------------------------------
BUS
1 1CPUB 02
2 1AI8B 00
3 1MIXA 00
4 .
;-------------------------------------------------------------------------------------
; Definizione Variabili INPUT
;-------------------------------------------------------------------------------------
INPUT
;-------------------------------------------------------------------------------------
; Definizione Variabili OUTPUT
;-------------------------------------------------------------------------------------
OUTPUT
ofGTSet1 F 3.OUT01 ;Segnalazione superamento setpoint 1->
ofLTSet2 F 3.OUT02 ;Segnalazione superamento setpoint 2<-
;-------------------------------------------------------------------------------------
; Dichiarazione device interni
;-------------------------------------------------------------------------------------
INTDEVICE
;Nome Tipo TCamp Contatore Type
Asse ANINP 0004 2.AI01 2
END
;*************************************************************************************
; Nome File: TASK_00.MOD
; Progetto: EX_ANINP
; Descrizione: Gestione Posizionamento
;*************************************************************************************
;-------------------------------------------------------------------------------------
; Operazioni di Inizializzazione Asse
;-------------------------------------------------------------------------------------
Asse:offset = 0 ;Tensione di offset
;-------------------------------------------------------------------------------------
; Fattore di scala: (scaleA * outbit / scaleB) + scaleC
; outUm minima = (4 * 0 / 8 ) + 3 = 3
; outUm massima = (4 * 4095 / 8) + 3 = 2050
;-------------------------------------------------------------------------------------
Asse:scaleA = 4 ;Fattore di scala A
Asse:scaleB = 8 ;Fattore di scala B
Asse:scaleC = 3 ;Fattore di scala C
Asse:tfilter = 10 ;Tempo del filtro di acquisizione
IF slSet1 EQ 0
slSet1 = 1500
ENDIF
IF slSet2 EQ 0
slSet2 = 300
ENDIF
;-------------------------------------------------------------------------------------
; Comparazioni sull'ingresso analogico
;-------------------------------------------------------------------------------------
; Variabili utilizzate
; slSet1 : Quota di comparazione per uscita ofGTSet1 (da impostare con Qview)
; slSet2 : Quota di comparazione per uscita ofLTSet2 (da impostare con Qview)
;-------------------------------------------------------------------------------------
MAIN:
IF Asse:outUmF GT slSet1 ;Se l'ingresso analogico è > del setpoint 1
SETOUT ofGTSet1 ;Attiva l'uscita ofGTSet1
ELSE
RESOUT ofGTSet1 ;Disattiva l'uscita ofGTSet1
ENDIF
IF Asse:outUmF LT slSet2 ;Se l'ingresso analogico è < del setpoint 2
SETOUT ofLTSet2 ;Attiva l'uscita ofLTSet2
ELSE
RESOUT ofLTSet2 ;Disattiva l'uscita ofLTSet2
ENDIF
WAIT 1
JUMP MAIN
END